/*
 * Downloader.h
 *
 *  Created on: Mar 24, 2014
 *      Author: alexander
 */

#ifndef DOWNLOADER_H_
#define DOWNLOADER_H_

#include <string>
#include <iostream>
#include <vector>

class Downloader
{
public:
//	Downloader();
//	Downloader(std::string address, unsigned int port);
	static void setProxyParams(const std::string& address, unsigned int port);
	static std::vector<std::string> fetchData(const std::string& url);

private:
	static const std::string HTTP_PREFIX;// = "http://";
	static const std::string HTTPS_PREFIX;// = "https://";

	static bool useProxy;
	static std::string proxyAddress;
	static unsigned int proxyPort;

	struct RequestData
	{
		std::string hostAddress;
		std::string httpRequest;
		RequestData(const std::string& addr, const std::string& req) : hostAddress(addr), httpRequest(req){}
	};

	static RequestData parseURL(const std::string& url);
	static std::string removeURLPrefix(const std::string& url);
};


#endif /* DOWNLOADER_H_ */
